<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>Promote Student</title>
</h:head>
<f:view>
	<h:body>
		<ui:composition template="../includes/template.xhtml">
			<ui:define name="mainbody">
				<center>
              <p:panel header="Promote Students" style="min-height: 550px" styleClass="prime_panel">
				<p:growl id="growl" showDetail="true" sticky="false" autoUpdate="true"  showSummary="false" />

					<p:messages id="messages" showDetail="true" autoUpdate="true" />
					<center>
					<h:form id="form">
				    <p:dataTable style="width: 50%" id="students" var="student" value="#{promoteStudentBean.studentModel}" paginator="true" rows="10"
				                 selection="#{promoteStudentBean.selectedStudentsList}">
				
				        <p:column selectionMode="multiple"  style="width:18px" />
				
						<p:column headerText="Student Name" filterBy="#{student.name}" style="width:50%">
				            #{student.name}  
				        </p:column>
				
				        <p:column headerText="Class" filterBy="#{student.section.clas.classTitle} #{student.section.sectionTitle}" style="width:50%">
				            #{student.section.clas.classTitle} #{student.section.sectionTitle}  
				        </p:column>
				
				        <f:facet name="footer">
				            <p:commandButton id="multiViewButton" value="Promote"
				                             update=":form:displayMulti" oncomplete="multiStudentDialog.show()"/>
				        </f:facet>
				    </p:dataTable>
				
				    <p:dialog id="multiDialog" header="Promote" widgetVar="multiStudentDialog"
				              showEffect="fade" hideEffect="explode">
				
				        <p:dataList id="displayMulti" >
				            
				        </p:dataList>
				        
				        <table>
							<tr>
								<tr>
									<td><h:outputText value="Promote to :" />
									</td>
									<td><p:spacer width="5" />
									<p:selectOneMenu
											value="#{promoteStudentBean.newClass}" effect="fade"
											id="newClass" converter="sectionConverter">
											<f:selectItems value="#{promoteStudentBean.sections}" var="s"
												itemLabel="#{s.clas.classTitle} - #{s.sectionTitle}"
												itemValue="#{s}" />
									</p:selectOneMenu></td>
								</tr>
							</tr>			        	
				        </table>
						<p:commandButton id="submit" value="Update" type="submit" ajax="false" action="#{promoteStudentBean.perform}"/>
				    </p:dialog>
				    </h:form>
				    </center>
</p:panel>
</center>
			</ui:define>
		</ui:composition>
	</h:body>
</f:view>
</html>
			